package com.itheima.controller;

import com.itheima.pojo.R;
import com.itheima.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/employee")
public class Controller {

    @Autowired
    private EmployeeService employeeService;

    @PostMapping("/login")
    public R login(String username,String password){

        boolean login = employeeService.login(username, password);

        System.out.println(login);
        return new R<String>(login?1:0,login?"登录成功":"登录失败!",username,null);
    }
}
